package com.hzdp.web.captcha;

import java.awt.image.BufferedImage;
import java.io.Serializable;

import com.octo.captcha.image.ImageCaptcha;

public class JCaptchaGimpy extends ImageCaptcha implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 9095723478126242676L;

	public JCaptchaGimpy(String question, BufferedImage challenge, String response) {
		super(question, challenge);
		this.response = response;
	}

	private String response;

	public String getResponse() {
		return response;
	}

	public void setResponse(String response) {
		this.response = response;
	}

	protected JCaptchaGimpy(String question, BufferedImage challenge) {
		super(question, challenge);
	}

	@Override
	public Boolean validateResponse(Object paramObject) {
		return (null != response) && ((response instanceof String)) ? validateResponse((String) response) : Boolean.FALSE;
	}

	private final Boolean validateResponse(String response) {
		return new Boolean(response.equals(this.response));
	}

}
